<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8" />
	<title>千郡医疗</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" th:href="@{/weixin/css/style.css}" />
	<link rel="stylesheet" th:href="@{/weixin/css/weui.min.css}" />
	<script type="text/javascript" th:src="@{/weixin/js/adaptive.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/fastclick.min.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/zepto.min.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/weui.min.js}"></script>
	<style type="text/css">
	 body{font-size: initial !important;}
	</style>
</head>
<body>
	<section class="loginPage">
		<i class="logo"></i>
		<form id="form" th:action="@{/weixin/login}" method="post">
		<input type="tel" name="mobile" id="mobile" class="txt" placeholder="请输入手机号码" />
		<input type="password" name="password" id="pwd" class="txt" placeholder="请输入登录密码" />
		<p class="subBox"><a href="###" id="submit" class="comBtn">登录</a></p>
		<p class="tip">温馨提醒：</p>
		<p class="tipContext">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;千郡会员管理系统于2018年4月18号正式上线，该系统将试运行六个月，此期间系统将不断升级，逐步完善，敬请期待！</p>
		</form>
	</section>
	
	<script type="text/javascript">
	$(function(){
		$("#submit").click(function() {
			if (!validate())
				return;

			var l = weui.loading("正在提交");
			$.ajax({
				cache : true,
				type : "POST",
				url : "/qianjun/weixin/login",
				data : $('#form').serialize(),
				error : function(request) {
					l.hide();
					weui.alert("登陆失败");
				},
				success : function(data) {
					l.hide();
					if(!data.success){
						weui.alert(data.msg);
						return;
					} 
					location.href = "/qianjun/weixin/customer";
				}
			});
		})
	})
	
	function validate() {
		if(!(/^1[34578]\d{9}$/.test($("#mobile").val()))){ 
	        weui.alert("请输入正确的手机号码");  
	        return false; 
	    } 		
		
		if($("#pwd").val() == ''){
			weui.alert("密码不能为空");
			return false;
		}

		return true;
	}
	
	</script>
</body>
</html>